LocationCache: Fixes read fallback to use WriteEndpoints[0] when PPAF enabled and all regions excluded#5823
Merged
ananth7592 merged 3 commits intomainfrom May 4, 2026
Merged
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…ind PPAF When ExcludeRegions filters out all preferred read regions and PPAF (Partition Level Failover) is enabled, GetApplicableEndpoints now falls back to WriteEndpoints[0] (dynamic, tracks current write region) instead of this.defaultEndpoint (static, region-agnostic URI set once at init). The fix is gated behind isPartitionLevelFailoverEnabled (Func<bool>) wired from ConnectionPolicy.EnablePartitionLevelFailover through GlobalEndpointManager, supporting dynamic enablement per PR #5310. When PPAF is disabled, original behavior (defaultEndpoint fallback) is preserved. Fixes #5821 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8b6cfce to
038e757
Compare
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Member
|
Shall we also update the verbaige in the |
…oint Modified the Verbiage for RequestOptions.ExcludeRegions to reflect the best-effort intent and to disambiguate the primary/hub verbiage. Validates that when GlobalPartitionEndpointManagerCore sets LocationEndpointToRoute (partition-level failover override), ResolveServiceEndpoint returns it directly at L341, bypassing ExcludeRegions filtering entirely. This proves no additional PPAF condition is needed in the GetApplicableEndpoints fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
kundadebdatta
approved these changes
May 4, 2026
kushagraThapar
approved these changes
May 4, 2026
Member
kushagraThapar
left a comment
There was a problem hiding this comment.
LGTM, thanks @ananth7592
NaluTripician
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When ApplicationPreferredRegions == ExcludeRegions, LocationCache.GetApplicableEndpoints falls back to his.defaultEndpoint — a static, region-agnostic URI set once at init and never updated. After a write region (hub) switch, the GlobalAddressResolver's cached EndpointCache for this default endpoint has a stale AddressResolver.location, causing incorrect region tracking in diagnostics, per-partition routing, and retry logic.
Fix
When PPAF (IsPartitionLevelFailoverEnabled) is enabled, GetApplicableEndpoints now uses WriteEndpoints[0] (dynamic, tracks current write region) as the read fallback instead of his.defaultEndpoint.
This aligns with:
PPAF Gating
The fix is gated behind Func isPartitionLevelFailoverEnabled wired from ConnectionPolicy.EnablePartitionLevelFailover through GlobalEndpointManager, supporting dynamic enablement per PR #5310. When PPAF is disabled, original behavior (defaultEndpoint fallback) is preserved.
Changes
Testing
All 94 LocationCacheTests pass.
Fixes #5821